﻿using NFine.Data.Extensions;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NBProject
{
    public class Export
    {
        /// <summary>
        /// 导入坡度数据库
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static int ExportSlope(DataTable dt)
        {
            string insertSql = "insert into T_SLOPE(Id, linename, direction, startmileage, endmileage,slope) values ('{0}', '{1}', '{2}',{3}, {4}, {5});";
            string sqlroleusr = "begin ";
            foreach (DataRow dr in dt.Rows)
            {
                if (dr["序号"].ToString() == "")
                {
                    continue;
                }
                var temp1 = string.Format(insertSql,System.Guid.NewGuid().ToString(), dr["线路名称"], dr["行别"], dr["起点里程"], dr["终点里程"], dr["坡度"]);
                sqlroleusr += temp1;
            }
            sqlroleusr += " end; ";
            int ret = DbHelper.ExecSQL(sqlroleusr);
            return ret;
        }
    }
}
